//
//  UILabel+HLExtension.m
//  weibo-OC
//
//  Created by 黄力 on 15/12/17.
//  Copyright © 2015年 HLTest. All rights reserved.
//

#import "UILabel+HLExtension.h"

@implementation UILabel (HLExtension)

- (instancetype)initWithTitle:(NSString *)title withTitleFont:(CGFloat)titleFont withTitleColor:(UIColor *)titleColor {
    self = [super init];
    if (self) {
        //设置文字
        self.text = title;
        if (title == nil) {
            //居左
            self.textAlignment = NSTextAlignmentLeft;
        }else {
            //居中
            self.textAlignment = NSTextAlignmentCenter;
        }
        //设置字体大小
        self.font = [UIFont systemFontOfSize:titleFont];
        //设置字体颜色
        self.textColor = titleColor;
        //设置自动换行
        self.numberOfLines = 0;
        [self sizeToFit];
    }
    return self;
}

@end
